#include<stdio.h>
#include<stdlib.h>

#include "def.h"
#include "nrio.h"
#include "nrarith.h"
#include "nralloc.h"



int main(void){

	long nrh,nrl,nch,ncl;
	rgb8 **I;
	int i,j;
	
	//Chargement dun fichier PPM, sauvegarde le fichier au format pgm	
	I=LoadPPM_rgb8matrix("cubesx3.ppm",&nrl,&nrh,&ncl,&nch);
	//SavePPM_rgb8matrix(I,nrl,nrh,ncl,nch,"cubesx3_bis_bis.ppm");
	SavePGM_bmatrix(I,nrl,nrh,ncl,nch,"cubesx3_bis_bis.pgm");
	
	I=LoadPGM_bmatrix("blocmotr.pgm",&nrl,&nrh,&ncl,&nch);
	SavePGM_bmatrix(I,nrl,nrh,ncl,nch,"blocmotr_bis.pgm");
	
	//ne marche pas quand le format PGM est sous format ascii
	/*I=LoadPGM_bmatrix("blocmotr_ascii.pgm",&nrl,&nrh,&ncl,&nch);
	SavePGM_bmatrix(I,nrl,nrh,ncl,nch,"blocmotr_ascii.pgm");*/
	
	free_rgb8matrix(I,nrl,nrh,ncl,nch);


	return 1;

}
